import ReactAce from 'react-ace-editor';
import React, { Component } from 'react';
import { Icon, Modal } from 'antd';
import './index.less';

class Detail extends React.Component {
  onChange(newValue, e) {
    // console.log(newValue, e);
    // const editor = this.ace.editor; // The editor object is from Ace's API
    // console.log(editor.getValue()); // Outputs the value of the editor
  }

  render() {
    const { visible, onCancel } = this.props;
    return (
      <Modal
        visible={visible}
        onCancel={onCancel}
        cancelText="关闭"
        okText="&nbsp;"
        className="scanClass"
        width="800px"
        footer={null}
        destroyOnClose={true}
      >
        <ReactAce
          mode="golang"
          theme="twilight"
          setReadOnly={true}
          setValue={this.props.scan}
          onChange={this.onChange}
          style={{ height: '400px' }}
          // ref={instance => { this.ace = instance; }} // Let's put things into scope
        />
      </Modal>
    );
  }
}

export default Detail;
